<template>
<table>
    <tr>
        <td>手机号</td>
        <td><input type="text" v-model="Utel"></td>
    </tr>
    <tr>
        <td>密码</td>
        <td><input type="password" v-model="Upwd"></td>
    </tr>
    <tr>
        <td>确认密码</td>
        <td><input type="password" v-model="qUpwd"></td>
    </tr>
    <tr>
        <td colspan="2">
            <button @click="Rigit">注册</button>
        </td>
    </tr>
</table>
</template>
<script setup lang="ts">
import { RefSymbol } from '@vue/reactivity';
import axios from 'axios';
import {ref} from 'vue'
const Utel=ref()
const Upwd=ref()
const qUpwd=ref()
const Rigit=()=>{
    if(!Utel.value){
        alert("手机号不能为空")
        return
    }
    if(!Upwd.value){
        alert("密码不能为空")
        return
    }
    if(!qUpwd.value){
        alert("确认密码不能为空")
        return
    }
    if(qUpwd.value!=Upwd.value){
        alert("两次密码输入不一致")
        return
    }
    axios.post('https://localhost:44369/api/Lx/Regit',
        {
            Utel:Utel.value,
            UserName:Utel.value,
            Upwd:Upwd.value
        }
    ).then(res=>{
        if(res.data==-1){
            alert("该用户已被注册")
            return
        }
        else if(res.data>0){
            alert("注册成功")
            return
        }
    }).catch(err=>{
        console.log(err)
    })
}


</script>